<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:zs="http://www.loc.gov/zing/srw/" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">

<xsl:output 
method="html"
omit-xml-declaration="yes"
indent="no"
/>
<!-- For standalone applications>
<xsl:output
method="html" />
-->



<xsl:template match="zs:searchRetrieveResponse">
	
<table class="table table-striped table-bordered table-hover table-condensed">
<!--START CORPUS-->

<colgroup>
<col width="100"></col>
<col width="200"></col>
<col width="50"></col>
<col width="200"></col>
</colgroup>

<tr bgcolor="#8ea0ef">
<th>ISN</th>
<th>Name</th>
<th>Date</th>
<th>Profession</th>
</tr>

<xsl:for-each select="zs:records/zs:record/zs:recordData/marc:record">

<xsl:variable name="link" >
<xsl:for-each select="marc:datafield[@tag=680]" >
<xsl:if test="contains(marc:subfield[@code='a']/text(), 'Digital Object Person Link')">
<xsl:variable name="digi" select="."/>
<a>
	<xsl:attribute name="href">
		<xsl:value-of select="substring-after(normalize-space($digi), 'Link: ')" />
	</xsl:attribute><xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']"/>
</a>
</xsl:if>
</xsl:for-each>
</xsl:variable>



<!-- <xsl:sort select="marc:datafield[@tag=100]/marc:subfield[@code='a']" lang="de"/> -->


<tr>
<!--ISN -->
<xsl:for-each select="marc:controlfield[@tag=001]"><td>
<a><xsl:attribute name="href">
http://lab.rism.info:9910/person?operation=searchRetrieve&amp;version=1.1&amp;query=id=
<xsl:value-of select="."/>&amp;maximumRecords=1
</xsl:attribute>
<xsl:value-of select="."/></a></td>
</xsl:for-each>

<!--AUTHOR-->
<xsl:for-each select="marc:datafield[@tag=100]"><td>
<xsl:copy-of select="$link"/> 
<xsl:value-of select="marc:subfield[@code='a']"/></td>
</xsl:for-each>
<!--TITLE-->
<xsl:for-each select="marc:datafield[@tag=100]"><td><xsl:value-of select="marc:subfield[@code='d']"/></td></xsl:for-each>
<td>

<!--OCCUPATION -->

<xsl:for-each select="marc:datafield[@tag=559]">
	<xsl:if test="position() &gt; 1">, </xsl:if>
		<xsl:value-of select="marc:subfield[@code='a']"/>
	</xsl:for-each></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
